$(document).ready(function(){
	login_filter();
});

function login_filter(){

	var loginState = server + "/server/login/current.json"
	$.getJSON(loginState, function(rtn){
		var refreshUrl = server + "/server/login/refresh.json";
		var uid = $.cookie("sm_user_id");
		if(uid == undefined){
			window.location.href = server + "/login.html?stat=none_cookie";
		}
		var data = {
			id : uid
		}
		if(0 == rtn.code){
			$.getJSON(refreshUrl, data, function (rtn) { 
				if(200 == rtn.code){
					window.location.reload();
					return true;
				}else{
					window.location.href = server + "/login.html?stat=none_cookie";
				}
			});
		}else{
			$.getJSON(refreshUrl, data, function (rtn){});
		}
	});
}